﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using System.Data;

namespace DAL
{
    public class OperatorDAL: DB
    { 
        public static IList<Operator> GetList()
        {
            IList<Operator> result = null;
            try
            {
                HIDB.dbo conn = HIDB.common.make();
                DataTable dt = conn.GetDataTable("SELECT [Operator],[anti_Operator] FROM [Working_db].[VW_OperatorList]");
                if (dt != null && dt.Rows.Count > 0)
                {
                    result = new List<Operator>();
                    Operator model = null;
                    foreach (DataRow item in dt.Rows)
                    {
                        model = new Operator();
                        model.LegalOperator = item["Operator"].ToString();
                        model.ILegalOperator = item["anti_Operator"].ToString();

                        result.Add(model);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return result;
        }
    }
}
